public class Text3_29 {
    public  static void Func(int[] A,int[] B,int m,int n) {
        int i = m - 1;
        int j = n - 1;
        int k = (m + n) - 1;
        while (i >= 0 && j >= 0) {
            if (A[i] > B[j]) {
                A[k] = A[i];
                k--;
                j--;
            } else {
                A[k] = B[j];
                k--;
                j--;
            }
        }
        while (i >= 0) {
            A[k] = A[i];
            i--;
            k--;
        }
        while (j >= 0) {
            A[k] = B[j];
            k--;
            j--;
        }
    }

    public static void main (String[] args) {
        int []A={1,2,3,0,0,0};
        int []B={4,5,6};
        Func(A,B,3,3);
        System.out.println(Arrays.toString(A));
    }

